<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function car(name,speed){//新建对象
            this.name = name;
            this.speed=speed;
            // this.showname=function(){
            //     //showname 属于对象 
            //     console.log(this.name)//可以调用
            // }
            car.prototype.showname = function(){
                console.log(this.name) // 本来showname属于car里面->showname属于car的原型
                //                                                  构造函数的原型
            }
        }
        var car1 =new car("奥迪",300)
        var car2 =new car("奔驰",280)
        console.log(car1.name)//用户自己写的名字
        car1.showname()
        car2.showname()
    </script>
</head>
<body>
    
</body>
</html>